import 'package:ball_lion/entity/match/zq_odds_entity.dart';

class SecretInfoEntity {
  String? away;
  bool? canRead;
  String? content;
  String? dcNo;
  String? freeTime;
  String? home;
  String? image;
  String? jcNo;
  String? leagueName;
  int? matchId;
  String? matchTime;
  String? publishTime;
  String? sfcNo;
  int? sportsId;
  String? tag;
  String? timeShow;
  String? title;
  int? status;
  List<OddsData>? firstOdds;
  List<OddsData>? realOdds;

  SecretInfoEntity(
      {this.away,
      this.canRead,
      this.content,
      this.dcNo,
      this.freeTime,
      this.home,
      this.image,
      this.jcNo,
      this.leagueName,
      this.matchId,
      this.matchTime,
      this.publishTime,
      this.sfcNo,
      this.sportsId,
      this.tag,
      this.timeShow,
      this.title,
      this.status,
      this.firstOdds,
      this.realOdds});

  SecretInfoEntity.fromJson(Map<String, dynamic> json) {
    away = json['away'];
    canRead = json['canRead'];
    String append = "";
    if (json['content'] != null) {
      json['content'].split("").forEach((element) {
        if (RegExp(r"[\u4e00-\u9fa5]").hasMatch(element)) {
          append += "$element\u200A";
        } else {
          append += element;
        }
      });
    }
    content = append;
    dcNo = json['dcNo'];
    freeTime = json['freeTime'];
    home = json['home'];
    image = json['image'];
    jcNo = json['jcNo'];
    leagueName = json['leagueName'];
    matchId = json['matchId'];
    matchTime = json['matchTime'];
    publishTime = json['publishTime'];
    sfcNo = json['sfcNo'];
    sportsId = json['sportsId'];
    tag = json['tag'];
    timeShow = json['timeShow'];
    title = json['title'];
    status = json['status'];
    if (json['odds'] != null) {
      firstOdds = <OddsData>[];
      json['odds']['firstOdds']?.forEach((v) {
        firstOdds!.add(new OddsData.fromJson(v));
      });
    }
    if (json['odds'] != null) {
      realOdds = <OddsData>[];
      json['odds']['realOdds']?.forEach((v) {
        realOdds!.add(new OddsData.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['away'] = this.away;
    data['canRead'] = this.canRead;
    data['content'] = this.content;
    data['dcNo'] = this.dcNo;
    data['freeTime'] = this.freeTime;
    data['home'] = this.home;
    data['image'] = this.image;
    data['jcNo'] = this.jcNo;
    data['leagueName'] = this.leagueName;
    data['matchId'] = this.matchId;
    data['matchTime'] = this.matchTime;
    data['publishTime'] = this.publishTime;
    data['sfcNo'] = this.sfcNo;
    data['sportsId'] = this.sportsId;
    data['tag'] = this.tag;
    data['timeShow'] = this.timeShow;
    data['title'] = this.title;
    data['status'] = this.status;
    if (this.firstOdds != null) {
      data['odds']['firstOdds'] =
          this.firstOdds!.map((v) => v.toJson()).toList();
    }
    if (this.realOdds != null) {
      data['odds']['realOdds'] = this.realOdds!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class SecretEntity {
  List<SecretInfoEntity>? secretList;
  int? total;

  SecretEntity({this.secretList, this.total});

  SecretEntity.fromJson(Map<String, dynamic> json) {
    if (json['rows'] != null) {
      secretList = [];
      json['rows'].forEach((v) {
        secretList!.add(new SecretInfoEntity.fromJson(v));
      });
    }
    total = json['total'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.secretList != null) {
      data['rows'] = this.secretList!.map((v) => v.toJson()).toList();
    }
    data['total'] = this.total;
    return data;
  }
}
